import QtQuick 2.12
import QtQuick.Controls 2.15

Rectangle{
    id:root
    
    property alias btwidth: root.width
    property alias btheight: root.height
    
    property alias fontsize: root.mFontSize
    property alias fontfamily: root.mFontFamily
    property alias fonttext: root.mFontText
    property alias btnbgcolor: root.mBtnBgColor
    property alias btnpresscolor: root.mBtnPressColor
    property alias btnreleasecolor: root.mBtnReleaseColor
    
    property int mFontSize: 20
    property string mFontFamily: "黑体"
    property string mFontText: "文字"
    property string mBtnBgColor: "#63a0f1"
    property string mBtnPressColor: "#000000"
    property string mBtnReleaseColor: "#FFFFFF"
    color: root.mBtnBgColor
    radius: 8
    signal clicked();
    Button{
        id:button
        height: parent.height
        width: parent.width
        anchors.horizontalCenter: parent.horizontalCenter
        anchors.verticalCenter: parent.verticalCenter
        background: Rectangle{
            color: root.mBtnBgColor
            radius: 8
        }
        Text {
            id: text
            color: button.down ? root.mBtnPressColor : root.mBtnReleaseColor
            text: root.mFontText
            font.pixelSize: root.mFontSize
            font.family: root.mFontFamily
            //水平居中于button
            anchors.horizontalCenter: parent.horizontalCenter
            //垂直居中于button
            anchors.verticalCenter: parent.verticalCenter
        }
        onClicked: root.clicked()
    }
    
}

